From: Aleksey Kolosov Date: Fri, 15 Nov 2024 07:42:55 +0000 (+0300) Subject: luci-app-statistics: fix prepare values from list vlaues X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22/%22https:/collectd.org/%22?a=commitdiff_plain;h=0a6a2f1fc5cbea81531e2c24ded46b4ecba27647;p=project%2Fluci.git luci-app-statistics: fix prepare values from list vlaues If UCI store values as a list instead of an option, conversation for the collectd configuration is not work correctly. This is due to the use of a DynamicList type element in the UI (for example, for the RRATimespans field). For this function argument val receives as array instead of a string, so no additional conversion is required. Signed-off-by: Aleksey Kolosov --- diff --git a/applications/luci-app-statistics/root/usr/libexec/stat-genconfig b/applications/luci-app-statistics/root/usr/libexec/stat-genconfig index 130f8f3876..0d6bd6704f 100755 --- a/applications/luci-app-statistics/root/usr/libexec/stat-genconfig +++ b/applications/luci-app-statistics/root/usr/libexec/stat-genconfig @@ -58,7 +58,7 @@ function parse_units(ustr) { const preprocess = { RRATimespans: function(val) { - return join(' ', map(split(val, /\s+/), parse_units)); + return join(' ', map(type(val) == 'array' ? val : split(val, /\s+/), parse_units)); } };